package com.example.qxglxt.controller;

import javax.annotation.Resource;

import com.example.qxglxt.dao.IUserRolesDao;
import com.example.qxglxt.model.UserRoles;

import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/userrole")
public class UserRolesController {

    @Resource
    private IUserRolesDao userRolesDao;

    @ApiOperation(value = "分配用户角色",notes = "分配用户角色")
    @PutMapping("/AddUserToRole")
    public UserRoles AddUser(@RequestBody UserRoles u){
        return userRolesDao.save(u);
    }
    @ApiOperation(value = "移除用户角色",notes = "移除用户角色")
    @PutMapping("/RemoveUser")
    public void RemoveUser(@RequestBody UserRoles u){
         userRolesDao.delete(u);;
    }
}